home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 5 / Amiga Tools 5.iso / tools / developer-tools / aros / source / exec / internal / m68k / new / exception.s < prev    next >
Encoding:
Text File  |  1996-07-16  |  1.2 KB  |  59 lines

  1.     Disable     =    -100
  2.     Enable      =    -105
  3.     ThisTask    =    284
  4.     IDNestCnt   =    302
  5.     tc_Flags    =    16
  6.     tc_SigRecvd =    28
  7.     tc_SigExcept=    32
  8.     tc_ExceptData=    40
  9.     tc_ExceptCode=    44
  10.     TF_EXCEPT   =    32
  11.     .text
  12.     .align 16
  13.     .globl    Exec_Exception
  14.     .type    Exec_Exception,@function
  15. Exec_Exception:
  16.     /* Get SysBase amd pointer to current task */
  17.     movl    4(%esp),%ebp
  18.     movl    ThisTask(%ebp),%edi
  19.  
  20.     /* Clear exception flag */
  21.     andb    $~TF_EXCEPT,tc_Flags(%edi)
  22.  
  23.     /* If the exception is raised out of Wait IDNestCnt may be >0 */
  24.     movb    IDNestCnt(%ebp),%ebx
  25.     /* Set it to a defined value */
  26.     movb    $0,IDNestCnt(%ebp)
  27.  
  28. exloop:    /* Get mask of signals causing the exception */
  29.     movl    tc_SigExcept(%edi),%ecx
  30.     andl    tc_SigRecvd(%edi),%ecx
  31.     je    excend
  32.  
  33.     /* Clear bits */
  34.     xorl    %ecx,tc_SigExcept(%edi)
  35.     xorl    %ecx,tc_SigRecvd(%edi)
  36.  
  37.     /* Raise exception. Enable Interrupts */
  38.     movl    tc_ExceptData(%edi),%eax
  39.     leal    Enable(%ebp),%edx
  40.     pushl    %ebp
  41.     call    *%edx
  42.     pushl    %ebp
  43.     pushl    %eax
  44.     pushl    %ecx
  45.     movl    tc_ExceptCode(%edi),%edx
  46.     call    *%edx
  47.     leal    Disable(%ebp),%edx
  48.     pushl    %ebp
  49.     call    *%edx
  50.     addl    $20,%esp
  51.  
  52.     /* Re-use returned bits */
  53.     orl    %eax,tc_SigExcept(%edi)
  54.     jmp    exloop
  55.  
  56. excend:    /* Restore IDNestCnt and return */
  57.     movb    %ebx,IDNestCnt(%ebp)
  58.     ret
  59.